package com.three.crm.location;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.three.crm.constant.AppConstant;

public class LocationReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i("TAG","收到了广播" + intent.getExtras().getString(AppConstant.INDEX));
        if (intent != null && intent.getExtras() != null) {
            String action = intent.getExtras().getString(AppConstant.INDEX);
            if (action.equals("location")) {
                Intent i = new Intent(context,UploadLocationService.class);
                i.putExtra(AppConstant.INDEX,intent.getExtras().getString(AppConstant.INDEX));
                UploadLocationService.enqueueWork(context,UploadLocationService.class,1,i);
               // UploadLocationService.enqueueWork(this,i);
                //context.startService(i);
            }
        }
    }
}
